home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 420 < prev    next >
Internet Message Format  |  1996-08-06  |  962b

  1. Path: solon.com!not-for-mail
  2. From: msb@sq.com
  3. Newsgroups: comp.std.c,comp.lang.c.moderated
  4. Subject: Re: Integral promotion.
  5. Date: 17 Feb 1996 12:06:45 -0600
  6. Organization: SoftQuad Inc., Toronto, Canada
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4g55fl$avl@solutions.solon.com>
  10. References: <4fstj7$2l6@solutions.solon.com> <4fvgvb$e0t@solutions.solon.com>
  11. NNTP-Posting-Host: solutions.solon.com
  12.  
  13. > > short test(short x1, short x2) {
  14. > >  short result;
  15. > >  result = x1 + x2;
  16. > The addition operator "+" converts your short operands to ints.
  17.  
  18. No, just using their values does that.  The operator + never sees
  19. operands narrower than int.  In the statement
  20.     x1; 
  21. the short is converted to int before being discarded.
  22. -- 
  23. Mark Brader, msb@sq.com | "Ah, determinism (likewise, forgetfulness) reigns."
  24. SoftQuad Inc., Toronto  |                                      --Steve Summit
  25.  
  26. My text in this article is in the public domain.
  27.